package opencv;
import java.awt.*;
import java.awt.geom.*;
import java.io.*;
import java.io.IOException;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
public class BNW
{
    public static void main()throws IOException
    {
        BufferedImage coloredImage = ImageIO.read(new File("imgg11.jpg"));
        BufferedImage blackNWhite = new BufferedImage(coloredImage.getWidth(),coloredImage.getHeight(),BufferedImage.TYPE_BYTE_BINARY);
        Graphics2D graphics = blackNWhite.createGraphics();
        graphics.drawImage(coloredImage, 0, 0, null);

        ImageIO.write(blackNWhite, "jpg", new File("imgg5_21.jpg"));
        //ImageDrawingApplet1 IDM1=new ImageDrawingApplet1();
        //IDM1.main();
    }
}
                